package com.itmuch.common.feignset.hystix;
import com.itmuch.common.context.QfContext;
import com.netflix.hystrix.strategy.concurrency.HystrixRequestContext;
import com.netflix.hystrix.strategy.concurrency.HystrixRequestVariableDefault;
public class QfHystrixRequestContext {

	//定义上下文的地址指针引擎，
    private static final HystrixRequestVariableDefault<QfContext> requestContextData = new HystrixRequestVariableDefault<>();

	private QfHystrixRequestContext() {}
	
	public static HystrixRequestVariableDefault<QfContext> getRequestVariableDefaultInstance() {
	    return requestContextData;
	}
	
	public static boolean isEnableHystrixRequestContext(){
		return QfHystrixRequestContextEnablerFilter.ENABLED_HYSTRIX_FILTER == true;
	}
	
	public static void setCrossThreadContext(QfContext context){
		if(HystrixRequestContext.getContextForCurrentThread()!=null){
			requestContextData.set(context);
		}
	}
}